<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<html>
	<head>
		<title>LPN管理</title>
	

		<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#lpn_warehouseCode").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate();
		});
		function comfirm(){
			$.ajax({
				   type : 'post',
					url : '${ctx}/v2_lpn/create',
					async:false,
					data:{
						LPN:$("#lpnNo").val().trim(),
						warehouseCode:$("#warehouseCode").val(),
						lpnType:$("#lpnType").val()
					},
					dataType : 'json',
					success : function(data) {
						var status=data.status;
						var content = data.content;
						if( status=='success'){
							alert(content);
							$("#lpnNo").val("");
						}else{
							alert(content);
						}
					},
					error : function() {
						jAlert("网络繁忙，请稍后重试...删除","温馨提示");
					}
				}); 
		}
	
</script>
	</head>

	<body>
	<section class="content">
	<c:if test="${not empty message}">
		<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
	</c:if>
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">LPN新增</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
		<form id="inputForm"  
			class="form-horizontal">
			<input type="hidden" name="id" value="${lpn.id}" />
			<fieldset>
			<div class="form-group row">
					<label for="lpn_warehouseCode" class="col-sm-3 control-label">
						仓库名称:
					</label>
					<div class="col-sm-6">
						<select  name="warehouseCode"  id="warehouseCode"   class="form-control required" >
						     <c:forEach items="${warehouseList}" var="warehouse">
						       <option value="${warehouse.groupCode}" 
						       <c:if test="${lpn.warehouseCode eq warehouse.groupCode }">selected=selected</c:if>
						       >${warehouse.groupName}</option>
						     </c:forEach>
						</select>
					</div>
				</div>
				<div class="form-group row">
					<label for="lpn_num" class="col-sm-3 control-label">
						类型:
					</label>
					<div class="col-sm-6">
						<select  name="lpnType"  id="lpnType"   class="form-control required" >
						     <option value="0">默认收货用</option> 
						     <option value="1">托盘</option>
						</select>
					</div>
				</div>
				<div class="form-group row">
					<label for="lpn_num" class="col-sm-3 control-label">
						LPNNO(仓库编码开头):
					</label>
					<div class="col-sm-6">
						<input type="text" id="lpnNo" name="lpnNo"
							class="form-control  required"/>
					</div>
				</div>
				<div class="modal-footer bg-gray">
					<input id="submit_btn" class="btn btn-primary" type="submit" onclick="comfirm();"
						value="提交" />
					&nbsp;
					<input id="cancel_btn" class="btn" type="button" value="返回"
						onclick="window.location.href='${ctx}/v2_lpn/v2_show'" />
				</div>
			</fieldset>
		</form>
	
		</div>
		</div>
		</div>
		</div>
		</section>
	</body>
</html>
